package org.zzh.controller.system.log;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import org.zzh.controller.BaseController;
import org.zzh.dao.common.PageBean;
import org.zzh.domain.system.log.StLog;
import org.zzh.service.system.log.StLogService;

@Controller
@RequestMapping("/system/log")
public class StLogController extends BaseController {

    @Autowired
    StLogService stLogService;

    @RequestMapping("list.do")
    public ModelAndView list(
            @RequestParam(required = false, value = "page", defaultValue = "1") Integer page,
            @RequestParam(required = false, value = "pageSize", defaultValue = "10") Integer pageSize,
            @RequestParam(required = false, value = "name", defaultValue = "") String name
    ) {
        PageBean<StLog> pageBean = stLogService.list(page, pageSize, name);
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("pageBean", pageBean);
        modelAndView.addObject("name", name);
        modelAndView.setViewName("/WEB-INF/pages/system/log/log-list");
        return modelAndView;
    }
}
